<!--答题页面-->
<template>
  <div id="answer">
    <!--顶部信息栏-->
    <div class="top">
      <ul class="item">
        <li><el-icon ref="toggle" @click="flag.slider_flag = !flag.slider_flag"><Menu/></el-icon></li>
        <li>{{examData.data.type}}-{{examData.data.subject}}</li>
        <li @click="flag.user_flag = !flag.user_flag">
          <el-icon><UserFilled/></el-icon>
          <div class="msg"  v-if="flag.user_flag" @click="flag.user_flag = !flag.user_flag">
            <p>姓名：{{userInfo.name}}</p>
            <p>准考证号:  {{userInfo.id}}</p>
          </div>
        </li>
        <li><el-icon><ArrowLeft /></el-icon></li>
      </ul>
    </div>
    <div class="flexarea">
      <!--左边题目编号区-->
      <transition name="slider-fade">
        <div class="left" v-if="flag.slider_flag">
          <ul class="l-top">
            <li>
              <a href="javascript:;"></a>
              <span>当前</span>
            </li>
            <li>
              <a href="javascript:;"></a>
              <span>未答</span>
            </li>
            <li>
              <a href="javascript:;"></a>
              <span>已答</span>
            </li>
            <li>
              <a href="javascript:;"></a>
              <span>标记</span>
            </li>
          </ul>
          <div class="l-bottom">
            <div class="item">
              <p>选择题部分</p>
              <ul>
                <li v-for="(list, index1) in examData.question[1]" :key="index1">
                  <a href="javascript:;"
                     @click="change(index1)"
                     :class="{'border': index === index1 && currentType === 1,
                     'bg': list.isClick}">
                    <span :class="{'mark': list.isMark === true}"></span>
                    {{index1+1}}
                  </a>
                </li>
              </ul>
            </div>
            <div class="item">
              <p>填空题部分</p>
              <ul>
                <li v-for="(list, index2) in examData.question[2]" :key="index2">
                  <a href="javascript:;"
                     @click="fill(index2)"
                     :class="{'border': index === index2 && currentType === 2,
                     'bg': list.isClick}">
                    <span :class="{'mark': list.isMark === true}"></span>
                    {{examData.topicCount[0]+index2+1}}
                  </a>
                </li>
              </ul>
            </div>
            <div class="item">
              <p>判断题部分</p>
              <ul>
                <li v-for="(list, index3) in examData.question[3]" :key="index3">
                  <a href="javascript:;" @click="judge(index3)"
                     :class="{'border': index === index3 && currentType === 3,
                     'bg': list.isClick}">
                    <span :class="{'mark': list.isMark === true}"></span>
                    {{examData.topicCount[0]+examData.topicCount[1]+index3+1}}
                  </a>
                </li>
              </ul>
            </div>
            <div class="final" @click="commit(true)">结束考试</div>
          </div>
        </div>
      </transition>
      <!--右边选择答题区-->
      <transition name="slider-fade">
        <div class="right">
          <div class="title">
            <p>{{title}}</p>
            <span>&nbsp;&nbsp;全卷共{{examData.topicCount[0] + examData.topicCount[1] + examData.topicCount[2]}}题&nbsp;&nbsp;
              <el-icon><Timer /></el-icon>倒计时：&nbsp;<b>{{examData.time}}</b>分钟</span>
          </div>
          <div class="content">
            <p class="topic"><span class="number">{{showInfo.number}}</span>{{showInfo.showExam.question}}</p>
            <div v-if="currentType === 1">
              <el-radio-group v-model="answer.radio[index]" @change="getChangeLabel" class="option">
                <el-radio :label="1">A:&nbsp;{{showInfo.showExam.optionA}}</el-radio>
                <el-radio :label="2">B:&nbsp;{{showInfo.showExam.optionB}}</el-radio>
                <el-radio :label="3">C:&nbsp;{{showInfo.showExam.optionC}}</el-radio>
                <el-radio :label="4">D:&nbsp;{{showInfo.showExam.optionD}}</el-radio>
              </el-radio-group>
              <el-button
                  class="analysis"
                  @click="flag.analysis_flag = !flag.analysis_flag"
                  v-if="$store.state.PracticeOrExam">点击查看/隐藏答案</el-button>
              <div class="analysis" v-if="$store.state.PracticeOrExam && flag.analysis_flag">
                <ul>
                  <li> <el-tag type="success">
                    正确答案：</el-tag><span class="right">{{showInfo.showExam.answer}}</span>
                  </li>
                  <li><el-tag>题目解析：</el-tag></li>
                  <li>{{showInfo.showExam.analysis == null ? '暂无解析': showInfo.showExam.analysis}}</li>
                </ul>
              </div>
            </div>
            <div class="fill" v-if="currentType === 2">
              <div v-for="(item,fillIndex) in fillpart" :key="fillIndex">
                <span>第{{fillIndex + 1}}空：</span>
                <el-input placeholder="请填在此处"
                          v-model="answer.fillAnswer[index][fillIndex]"
                          clearable
                          @blur="getFill">
                </el-input><br>
              </div>
              <el-button
                  class="analysis"
                  @click="flag.analysis_flag = !flag.analysis_flag"
                  v-if="$store.state.PracticeOrExam">点击查看/隐藏答案</el-button>
              <div class="analysis" v-if="$store.state.PracticeOrExam && flag.analysis_flag">
                <ul>
                  <li> <el-tag type="success">
                    正确答案：</el-tag><span class="right">{{showInfo.showExam.answer}}</span></li>
                  <li><el-tag>题目解析：</el-tag></li>
                  <li>{{showInfo.showExam.analysis === null ? '暂无解析': showInfo.showExam.analysis}}</li>
                </ul>
              </div>
            </div>
            <div class="judge" v-if="currentType == 3">
              <el-radio-group v-model="answer.judgeAnswer[index]" @change="getJudgeLabel" class="option">
                <el-radio :label="1">正确</el-radio>
                <el-radio :label="2">错误</el-radio>
              </el-radio-group>
              <el-button
                  class="analysis"
                  @click="flag.analysis_flag = !flag.analysis_flag"
                  v-if="$store.state.PracticeOrExam">点击查看/隐藏答案</el-button>
              <div class="analysis" v-if="$store.state.PracticeOrExam && flag.analysis_flag">
                <ul>
                  <li> <el-tag type="success">
                    正确答案：</el-tag><span class="right">{{showInfo.showExam.answer === 'T' ? '正确':'错误'}}</span>
                  </li>
                  <li><el-tag>题目解析：</el-tag></li>
                  <li>{{showInfo.showExam.analysis == null ? '暂无解析': showInfo.showExam.analysis}}</li>
                </ul>
              </div>
            </div>
          </div>
          <div class="operation">
            <ul class="end">
              <li @click="previous()"><el-icon><ArrowLeft /></el-icon><span>上一题</span></li>
              <li @click="mark()"><el-icon><CollectionTag /></el-icon><span>标记</span></li>
              <li @click="unMark()"><el-icon><CloseBold style="color: red"/></el-icon><span>取消标记</span></li>
              <li @click="next()"><span>下一题</span><el-icon><ArrowRight /></el-icon></li>
            </ul>
          </div>
        </div>
      </transition>
    </div>
  </div>
</template>

<script>
import {useRoute, useRouter} from "vue-router/dist/vue-router";
import {getCurrentInstance, onMounted, reactive, ref, watch} from "vue";
import {useStore} from "vuex";
import {Menu,UserFilled,ArrowLeft,Timer,CollectionTag,ArrowRight,CloseBold} from '@element-plus/icons-vue'
import {ElMessage, ElMessageBox} from "element-plus";
import {getTime} from "@/utils/funUtils";
import {useDocumentVisibility,usePageLeave} from "@vueuse/core/index";
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "answer",
  components: {Menu,UserFilled,ArrowLeft,Timer,CollectionTag,ArrowRight,CloseBold},
  setup(){
    const router = useRouter()
    const route = useRoute()
    const {proxy} = getCurrentInstance()
    const store = useStore()
    let index = ref(0)//全局index
    let currentType = ref(1)//当前题型类型  1--选择题  2--填空题  3--判断题
    let fillpart = ref(null)//填空题的空格数量
    let title = ref("请选择正确的选项")
    let userInfo = reactive({//用户信息
      // eslint-disable-next-line no-undef
      name: $cookies.get("name"),
      // eslint-disable-next-line no-undef
      id: $cookies.get("id")
    })
    let flag = reactive({//标识符
      bg_flag: false, //已答标识符,已答改变背景色
      isFillClick: false, //选择题是否点击标识符
      slider_flag: true, //左侧显示隐藏标识符
      user_flag: false, //个人信息显示隐藏标识符
      analysis_flag: false
    })
    let examData = reactive({
      data: {},//考试信息
      question: {},//题目信息
      score: [],//每种类型分数的总数
      topicCount: [],//每种类型题目的总数
      startTime: null, //考试开始时间
      time: null, //考试持续时间
    })
    let answer = reactive({//答案信息
      fillAnswer: [[]], //二维数组保存所有填空题答案
      judgeAnswer: [], //保存所有判断题答案
      radio: []//保存考生所有选择题的选项
    })
    let showInfo = reactive({
      showExam: [],//显示考试信息
      number: 1, //题号
      part: null, //填空题的空格数量
    })

    //防作弊
    // visibility 离开页面-hidden  进入页面-visible
    //const visibility = useDocumentVisibility();
    //鼠标是否离开页面 离开页面-true
    const mouseLave = usePageLeave()
    // 切屏数据
    const screenCutting = reactive({
      setTime: 1, // 设置切屏时间
      setMouseLeave: 2,//设置鼠标离开超时时间
      setNum: 3, // 设置数量
      time: 0, // 实际时间
      mouseTime: 0,
      num: 0, // 实际数量
    });
    function cheat(){
      // 监听 visibility
      /*watch(visibility, (current, previous) => {
        if (current === "hidden") {
          // 记住离开当前时间戳
          screenCutting.time = new Date().getTime();
        }
        if (current === "visible" && previous === "hidden") {
          // 进来时间戳
          const currentTime = new Date().getTime();
          // 时间单位 s
          const diff = (currentTime - screenCutting.time) / 1000;
          if (diff >= screenCutting.setTime) {
            // 切屏数量 + 1
            screenCutting.num += 1;
          }
        }
      });*/
      //监听鼠标是否离开页面
      watch(mouseLave,(newValue)=>{
        if (newValue){
          // 记住离开当前时间戳
          screenCutting.mouseTime = new Date().getTime();
        }
        if (!newValue){
          // 进来时间戳
          const currentTime = new Date().getTime();
          // 时间单位 s
          const diff = (currentTime - screenCutting.mouseTime) / 1000;
          if (diff >= screenCutting.setMouseLeave) {
            // 切屏数量 + 1
            screenCutting.num += 1;
          }
        }
      })
      watch(()=>screenCutting.num,(newValue)=>{
        if (newValue > screenCutting.setNum){
          ElMessageBox.alert(
              `您已超过${screenCutting.setNum}次，系统将自动交卷`,
              '警告',
              {
                confirmButtonText: '确认',
              }
          ).then(() => {
            ElMessage({
              type: 'info',
              message: '自动交卷',
            })
          })
          commit(false)
          return
        }
        ElMessageBox.alert(
            `您离开页面，系统判定为作弊，该考试已切出${screenCutting.num}次,超过${screenCutting.setNum}次系统将自动交卷`,
            '警告',
            {
              confirmButtonText: '确认',
            }
        ).then(() => {
          ElMessage({
            type: 'info',
            message: '继续考试',
          })
        })
      })
    }

    onMounted(()=>{
      getExamData()
      showTime()
      if (!store.state.PracticeOrExam){
        cheat()
      }
    })
    function getExamData(){
      examData.startTime = getTime(new Date())//日期格式化
      proxy.$axios.get(
          // eslint-disable-next-line no-undef
          `/exam/${route.query.id}`
      ).then(
          response => {
            examData.data = response.data
            index.value = 0
            examData.time = examData.data.time
            proxy.$axios.get(
                // eslint-disable-next-line no-undef
                `/paper/${examData.data.paperId}`
            ).then(
                response => {
                  examData.question = response.data
                  const arr = Object.keys(examData.question) //获取key，也就是1，2，3
                  arr.forEach((item)=>{
                    let data = examData.question[item]//获取每种题型数据
                    examData.topicCount.push(data.length)
                    let currentScore = 0
                    for(let i = 0; i< data.length; i++) { //循环每种题型,计算出总分
                      currentScore += data[i].score
                    }
                    examData.score.push(currentScore) //把每种题型总分存入score
                  })
                  let father = []
                  for(let i = 0; i < examData.topicCount[1]; i++) { //根据填空题数量创建二维空数组存放每道题答案
                    let children = [null,null,null,null,null,null,null,null]
                    father.push(children)
                  }
                  answer.fillAnswer = father
                  //初始化数据
                  let dataInit = examData.question[1]
                  showInfo.number = 1
                  showInfo.showExam = dataInit[0]
                },
                error => {
                  console.log('请求失败', error.message)
                }
            )
          },
          error => {
            console.log('请求失败', error.message)
          }
      )
    }
    function showTime() { //倒计时
      setInterval(() => {
        examData.time -= 1
        if(examData.time === 10) {
          ElMessage({
            showClose: true,
            type: 'info',
            message: '考生注意,考试时间还剩10分钟！！！',
          })
          if(examData.time === 0) {
            ElMessage({
              showClose: true,
              type: 'error',
              message: '考试时间已到,强制交卷！！！',
            })
            commit(true)
          }
        }
      },1000 * 60)
    }
    function change(index1) { //选择题题号改变
      index.value = index1
      showInfo.showExam = examData.question[1][index.value]
      flag.isFillClick = true
      if (!store.state.PracticeOrExam) {
        flag.analysis_flag = false
      }
      currentType.value = 1
      title.value = "请选择正确的选项"
      showInfo.number = index.value + 1
    }
    function fill(index2) { //填空题题号改变
      index.value = index2
      showInfo.showExam = examData.question[2][index.value]
      flag.isFillClick = false
      if (!store.state.PracticeOrExam) {
        flag.analysis_flag = false
      }
      currentType.value = 2
      title.value = "请在横线处填写答案"
      showInfo.number = index.value + 1
      fillpart.value = showInfo.showExam.question.split("()").length - 1//根据题目中括号的数量确定填空横线数量
    }
    function judge(index3){
      index.value = index3
      showInfo.showExam = examData.question[3][index.value]
      flag.isFillClick = false
      if (!store.state.PracticeOrExam) {
        flag.analysis_flag = false
      }
      currentType.value = 3
      title.value = "请作出正确判断"
      showInfo.number = index.value + 1
    }
    function getChangeLabel(value) { //获取选择题作答选项
      answer.radio[index.value] = value //当前选择的序号
      examData.question[1][index.value]["isClick"] = true //添加一个属性
      /* 保存学生答题选项 */
      answer.topic1Answer[index.value] = value//
    }
    function getFill() { //填空题已答题目 如果已答该题目,设置元素为true为标识符
      let arr = answer.fillAnswer[index.value].slice(0, fillpart.value);
      if (arr.every(str => str === '')) { //都为字符串
        examData.question[2][index.value]["isClick"] = false
      }else {
        examData.question[2][index.value]["isClick"] = true
      }
    }
    function getJudgeLabel(value) {  //获取判断题作答选项
      answer.judgeAnswer[index.value] = value
      examData.question[3][index.value]["isClick"] = true //添加一个属性
    }
    function previous() { //上一题
      if (index.value === 0 && currentType.value === 1){
        ElMessage({
          type: 'error',
          message: '不能往前了',
        })
        return
      }
      index.value--
      switch(currentType.value) {
        case 1:
          change(index.value)
          break
        case 2:
          if(index.value < 0){
            change(examData.topicCount[0] - 1)
          }else {
            fill(index.value)
          }
          break
        case 3:
          if(index.value < 0){
            fill(examData.topicCount[1] - 1)
          }else {
            judge(index.value)
          }
          break
      }
    }
    function next(){ //下一题
      if (index.value === examData.topicCount[2] - 1 && currentType.value === 3){
        ElMessage({
          type: 'error',
          message: '不能往后了',
        })
        return
      }
      index.value++
      switch(currentType.value) {
        case 1:
          if (index.value > examData.topicCount[0]-1){
            fill(0)
          }else {
            change(index.value)
          }
          break
        case 2:
          if (index.value > examData.topicCount[1]-1){
            judge(0)
          }else {
            fill(index.value)
          }
          break
        case 3:
          judge(index.value)
          break
      }
    }
    function mark() { //标记功能
      switch(currentType.value) {
        case 1:
          examData.question[1][index.value]["isMark"] = true //选择题标记
          break
        case 2:
          examData.question[2][index.value]["isMark"] = true //填空题标记
          break
        case 3:
          examData.question[3][index.value]["isMark"] = true //判断题标记
      }
    }
    function unMark() { //取消标记功能
      switch(currentType.value) {
        case 1:
          examData.question[1][index.value]["isMark"] = false //选择题标记
          break
        case 2:
          examData.question[2][index.value]["isMark"] = false //填空题标记
          break
        case 3:
          examData.question[3][index.value]["isMark"] = false //判断题标记
      }
    }
    function sumScore(){
      /* 计算选择题总分 */
      let choiceScore = 0
      answer.radio.forEach((item,key) => { //循环每道选择题根据选项计算分数
        let rightAnswer = null
        if(item != null) {
          switch(item) { //选项1,2,3,4 转换为 "A","B","C","D"
            case 1:
              rightAnswer = "A"
              break
            case 2:
              rightAnswer = "B"
              break
            case 3:
              rightAnswer = "C"
              break
            case 4:
              rightAnswer = "D"
          }
          if(rightAnswer === examData.question[1][key].answer) { // 当前选项与正确答案对比
            choiceScore += examData.question[1][key].score // 计算总分数
          }
        }
      })
      /**计算判断题总分 */
      let fillScore = 0
      answer.fillAnswer.forEach((item,key) => { //此处index和 this.index数据不一致，注意
        item.forEach((inner,i) => {
          let rightAnswerSplit = examData.question[2][key].answer.split(',')
          rightAnswerSplit.forEach((value,j) => {//判断填空答案是否与数据库一致
            if (i === j && inner !== null) {
              let amswerTOrF = false
              let valueSplit = value.split('/')
              valueSplit.forEach((element) => {
                if (element === inner) amswerTOrF = true
              })
              if (amswerTOrF) {
                fillScore += (examData.question[2][key].score / (rightAnswerSplit.length))
              }
            }
          })
        })
      });
      /** 计算判断题总分 */
      let judgeScore = 0
      answer.judgeAnswer.forEach((item,key) => {
        let rightAnswer = null
        switch(item) {
          case 1:
            rightAnswer = "T"
            break
          case 2:
            rightAnswer = "F"
        }
        if(rightAnswer === examData.question[3][key].answer) { // 当前选项与正确答案对比
          judgeScore += examData.question[3][key].score // 计算总分数
        }
      })
      let totalScore = choiceScore + fillScore + judgeScore
      console.log(totalScore)
      return totalScore
    }
    function commitPaper(totalScore,answerDate){
      proxy.$axios.post(
          // eslint-disable-next-line no-undef
          `/score/add`,
          {
            examId: examData.data.id,
            studentId: userInfo.id,
            subject: examData.data.subject,
            score: totalScore,
            answerDate: answerDate
          }
      ).then(
          response => {
            console.log(response.data)
            router.push({path:'/studentScore',query: {
                ...examData.data,
                score: totalScore,
                startTime: examData.startTime,
                endTime: getTime(new Date())
              }})
          },
          error => {
            console.log('请求失败', error.message)
          }
      )
    }
    function commit(flag) { //答案提交计算分数
      let totalScore = sumScore()
      let answerDate = getTime(new Date()).substring(0,10)
      if(examData.time !== 0 && flag) {//考试时间未到提交交卷
        ElMessageBox.confirm(
            "考试结束时间未到,是否提前交卷",
            "友情提示",
            {
              confirmButtonText: '立即交卷',
              cancelButtonText: '检查一下',
              type: 'warning'
            }
        ).then(() => {
          /*交卷*/
          //提交成绩信息
          commitPaper(totalScore,answerDate)
        }).catch(() => {
          ElMessage({
            type: '',
            message: '继续考试',
          })
        })
      }else if(!flag){
        commitPaper(0,answerDate)
      }else {//时间到了交卷
        commitPaper(totalScore,answerDate)
      }
    }
    return{
      userInfo,
      flag,
      examData,
      answer,
      showInfo,
      index,
      currentType,
      fillpart,
      title,
      change,
      fill,
      judge,
      getChangeLabel,
      getJudgeLabel,
      getFill,
      previous,
      next,
      mark,
      unMark,
      commit
    }
  }
}
</script>

<style scoped>
.iconfont.icon-time {
  color: #2776df;
  margin: 0px 6px 0px 20px;
}
.analysis {
  margin-top: 20px;
}
analysis .right {
  color: #2776df;
  font-size: 18px;
  border: 1px solid #2776df;
  padding: 0px 6px;
  border-radius: 4px;
  margin-left: 20px;
}
analysis ul li:nth-child(2) {
  margin: 20px 0px;
}
analysis ul li:nth-child(3) {
  padding: 10px;
  background-color: #d3c6c9;
  border-radius: 4px;
}

.analysis span:nth-child(1) {
  font-size: 18px;
}
.mark {
  position: absolute;
  width: 4px;
  height: 4px;
  content: "";
  background-color: red;
  border-radius: 50%;
  top: 0px;
  left: 22px;
}
.border {
  position: relative;
  border: 1px solid #FF90AA !important;
}
.bg {
  background-color: #5188b8 !important;
}
.fill .el-input {
  display: inline-flex;
  width: 150px;
  margin-left: 20px;
}
.fill .el-input .el-input__inner {
  border: 1px solid transparent;
  border-bottom: 1px solid #eee;
  padding-left: 20px;
}

/* slider过渡效果 */
.slider-fade-enter-active {
  transition: all .3s ease;
}
.slider-fade-leave-active {
  transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slider-fade-enter, .slider-fade-leave-to {
  transform: translateX(-100px);
  opacity: 0;
}

.operation .end li:nth-child(2) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgb(39, 118, 223);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  color: #fff;
}
.operation .end li {
  cursor: pointer;
  margin: 0 100px;
}
.operation {
  background-color: #fff;
  border-radius: 4px;
  padding: 10px 0px;
  margin-right: 10px;
}
.operation .end {
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgb(39, 118, 223);
}
.content .number {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  background-color: rgb(39, 118, 223);
  border-radius: 4px;
  margin-right: 4px;
}
.content {
  padding: 0px 20px;
}
.content .topic {
  padding: 20px 0px;
  padding-top: 30px;
}
.right .content {
  background-color: #fff;
  margin: 10px;
  margin-left: 0px;
  height: 470px;
}
.content .el-radio-group label {
  color: #000;
  margin: 5px 0px;
}
.content .el-radio-group {
  display: flex;
  flex-direction:column;
}
.right .title p {
  margin-left: 20px;
}
.flexarea {
  display: flex;
}
.flexarea .right {
  flex: 1;
}
.auto-right {
  margin-left: auto;
  color: #2776df;
  margin-right: 10px;
}
.right .title {
  margin-right: 10px;
  padding-right: 30px;
  display: flex;
  margin-top: 10px;
  background-color: #fff;
  height: 50px;
  line-height: 50px;
}
.clearfix {
  clear: both;
}
.l-bottom .final {
  cursor: pointer;
  display: inline-block;
  text-align: center;
  background-color: rgb(39, 118, 223);
  width: 240px;
  margin: 20px 0px 20px 10px;
  border-radius: 4px;
  height: 30px;
  line-height: 30px;
  color: #fff;
  margin-top: 22px;
}
#answer .left .item {
  padding: 0px;
  font-size: 16px;
}
.l-bottom {
  border-radius: 4px;
  background-color: #fff;
}
.l-bottom .item p {
  margin-bottom: 15px;
  margin-top: 10px;
  color: #000;
  margin-left: 10px;
  letter-spacing: 2px;
}
.l-bottom .item li {
  width: 15%;
  margin-left: 5px;
  margin-bottom: 10px;
}
.l-bottom .item {
  display: flex;
  flex-direction: column;
}
.l-bottom .item ul {
  width: 100%;
  margin-bottom: -8px;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}
.l-bottom .item ul li a {
  position: relative;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #fff;
  border: 1px solid #eee;
  text-align: center;
  color: #000;
  font-size: 16px;
}
.left .l-top {
  display: flex;
  justify-content: space-around;
  padding: 16px 0px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 10px;
  background-color: #fff;
}
.left {
  width: 260px;
  height: 100%;
  margin: 10px 10px 0px 10px;
}
.left .l-top li:nth-child(2) a {
  border: 1px solid #eee;
}
.left .l-top li:nth-child(3) a {
  background-color: #5188b8;
  border: none;
}
.left .l-top li:nth-child(4) a {
  position: relative;
  border: 1px solid #eee;
}
.left .l-top li:nth-child(4) a::before {
  width: 4px;
  height: 4px;
  content: " ";
  position: absolute;
  background-color: red;
  border-radius: 50%;
  top: 0px;
  left: 16px;
}
.left .l-top li {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.left .l-top li a {
  display: inline-block;
  padding: 10px;
  border-radius: 50%;
  background-color: #fff;
  border: 1px solid #FF90AA;
}
#answer .top {
  background-color: rgb(39, 118, 223);
}
#answer .item {
  color: #fff;
  display: flex;
  padding: 20px;
  font-size: 20px;
}
#answer .top .item li:nth-child(1) {
  margin-right: 10px;
}
#answer .top .item li:nth-child(3) {
  position: relative;
  margin-left: auto;
}
#answer {
  padding-bottom: 30px;
}
.icon20 {
  font-size: 20px;
  font-weight: bold;
}
.item .msg {
  padding: 10px 15px;
  border-radius: 4px;
  top: 47px;
  right: -30px;
  color: #6c757d;
  position: absolute;
  border: 1px solid rgba(0,0,0,.15);
  background-color: #fff;
}
.item .msg p {
  font-size: 16px;
  width: 200px;
  text-align: left;
}
.option{
  align-items: flex-start;
}
</style>